package searchteam.server.services;

import java.util.Collection;

import searchteam.client.beansMirrors.PaperMirror;
import searchteam.client.beansMirrors.PersonMirror;
import searchteam.client.beansMirrors.TeamMirror;
import searchteam.client.services.SearchTeamServices;
import searchteam.server.RMIManager;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class SearchTeamServicesImpl extends RemoteServiceServlet implements SearchTeamServices {

	private static final long serialVersionUID = -6087145529050123359L;

	public Collection<PersonMirror> getAllPersons() {
		return RMIManager.getInstance().getSearchTeamFacade().getAllPersons();
	}
	
	public int createPerson(PersonMirror person) {
		return RMIManager.getInstance().getSearchTeamFacade().createPerson(person);
	}
	
	public int updatePerson(PersonMirror person) {
		return RMIManager.getInstance().getSearchTeamFacade().updatePerson(person);
	}
	
	public Collection<PaperMirror> getAllPapers() {
		return RMIManager.getInstance().getSearchTeamFacade().getAllPapers();
	}
	
	public int createPaper(PaperMirror paper) {
		return RMIManager.getInstance().getSearchTeamFacade().createPaper(paper);
	}

	public int updatePaper(PaperMirror paper) {
		return RMIManager.getInstance().getSearchTeamFacade().updatePaper(paper);
	}
	
	public Collection<TeamMirror> getAllTeams() {
		return RMIManager.getInstance().getSearchTeamFacade().getAllTeams();
	}

	public int createTeam(TeamMirror team) {
		return RMIManager.getInstance().getSearchTeamFacade().createTeam(team);
	}
	
	public int updateTeam(TeamMirror team) {
		return RMIManager.getInstance().getSearchTeamFacade().updateTeam(team);
	}
	
	public void addPersonToTeam(PersonMirror person, TeamMirror team) {
		RMIManager.getInstance().getSearchTeamFacade().addPersonToTeam(person, team);
	}
	
	public void linkPersonsToPaper(Collection<PersonMirror> persons, PaperMirror paper) {
		RMIManager.getInstance().getSearchTeamFacade().linkPersonsToPaper(persons, paper);
	}
	
	public void linkPapersToPerson(Collection<PaperMirror> papers, PersonMirror person) {
		RMIManager.getInstance().getSearchTeamFacade().linkPapersToPerson(papers, person);
	}
	
}
